Lucky numbers programming interview question